

#include <iostream>
using namespace std;

#include <vector>

void Test1()
{
	vector<int> first;
	vector<int> second(3, 7);
	vector<int> third(second.begin(), second.end());
	vector<int> fourth(third);

	for (auto i : first)
	{
		cout << first[0] << " ";
	}
	cout << endl;

	for (auto i : second)
	{
		cout << second[0] << " ";
	}
	cout << endl;

	vector<int>::iterator it = third.begin();
	while (it != third.end())
	{
		//cout << typeid(it).name();
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto i : fourth)
	{
		//cout << typeid(i).name();
		cout << fourth[0] << " ";
	}
	cout << endl;
}

void Test2()
{
	vector<int> v{ 1, 2, 3, 4, 5 };

	//vector<int>::iterator it = v.begin();
	auto it = v.begin();
	while (it != v.end())
	{
		cout << *it++ << " ";
	}
	cout << endl;

	auto rit = v.rbegin();
	while (rit != v.rend())
	{
		cout << *rit << " ";
		++rit;
	}
	cout << endl;
}

void Test3()
{
	vector<int> v;

	cout << "size:" << v.size() << endl;
	cout << "capacity:" << v.capacity() << endl;
	
	size_t capacity = v.capacity();
	for (int i = 0; i < 120; ++i)
	{
		if (capacity != v.capacity())
		{
			cout << "size:" << v.size() << "	" << "capacity:" << v.capacity() << endl;
			capacity = v.capacity();
		}

		v.push_back(i);
	}
}

void Test4()
{
	vector<int> v(10, 1);

	int i = 0;
	for (auto it = v.begin(); it != v.end(); ++it)
	{
		if (i && 0 == i % 10)
			cout << endl;

		//cout << *it+i << " ";
		printf("%3d", *it + i);
		++i;
	}
	cout << endl;

	cout << "size:" << v.size() << endl;
	cout << "capacity:" << v.capacity() << endl;
	cout << "empty:" << v.empty() << endl;
}

int main()
{
	//Test1();
	//Test2();
	Test3();
	//Test4();



	return 0;
}